package com.bw.exam.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bw.exam.pojo.ItemCat;
import com.bw.exam.result.R;
import com.bw.exam.service.ItemCatService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: liuzhiping
 * @date: 2024/7/25 11:49
 **/
@Slf4j
@RestController
@RequestMapping("/business/itemCat")
public class ItemCatController {

    @Resource
    com.bw.exam.mapper.ItemCatMapper itemCatMapper;

    @Autowired
    private ItemCatService itemCatService;



    @GetMapping("/findByPid/{pid}")
    public R findById(@PathVariable  Long pid){


        System.out.println("------------>");

        log.info("商品类目 findById:"+ pid);
        System.out.println("pid="+pid);
        LambdaQueryWrapper<ItemCat> queryWrapper = new LambdaQueryWrapper<ItemCat>();
        queryWrapper.eq(ItemCat::getParentId,pid);
        List<ItemCat> list = itemCatService.list(queryWrapper);
        return R.success(list);
    }

}
